package com.ctshk.sapp.system.controller;


import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.model.PageResponse;
import com.ctshk.rpc.system.dto.MainDataTeaPartyPlaceDTO;
import com.ctshk.rpc.system.req.MainDataBankAccountReq;
import com.ctshk.rpc.system.req.MainDataTeaPartyPlaceIdReq;
import com.ctshk.rpc.system.req.MainDataTeaPartyPlaceListReq;
import com.ctshk.rpc.system.req.MainDataTeaPartyPlaceReq;
import com.ctshk.rpc.system.service.IMainDataTeaPartyPlaceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.ctshk.common.web.support.BaseController;

import javax.validation.Valid;

/**
 * <p>
 * 茶會地點表 前端控制器
 * </p>
 *
 * @author 谢诗宏
 * @since 2021-03-17
 */
@Api(value = "主數據茶會地點",tags = "主數據茶會地點")
@RestController
@RequestMapping("/main/data/tea/party/place")
public class MainDataTeaPartyPlaceController extends BaseController {
    
    @DubboReference
    private IMainDataTeaPartyPlaceService mainDataTeaPartyPlaceService;


    /**
     * 新增茶會地點
     * @param req
     * @return
     */
    @ApiOperation(value="新增茶會地點", notes="新增茶會地點")
    @OperationLogAnnotation(operModul = OperationLogModel.SYSTEM, operType = OperationLogType.ADD, operTitle = "新增茶會地點", operDesc = "新增茶會地點")
    @PostMapping("/add")
    public Result add(@RequestBody @Valid MainDataTeaPartyPlaceReq req){
        return mainDataTeaPartyPlaceService.add(req,getCurrentUser(getRequest()));
    }

    /**
     * 編輯茶會地點
     * @param req
     * @return
     */
    @ApiOperation(value="編輯茶會地點", notes="編輯茶會地點")
    @OperationLogAnnotation(operModul = OperationLogModel.SYSTEM, operType = OperationLogType.UPDATE, operTitle = "編輯茶會地點", operDesc = "編輯茶會地點")
    @PostMapping("/update")
    public Result update(@RequestBody @Valid MainDataTeaPartyPlaceReq req){
        return mainDataTeaPartyPlaceService.update(req,getCurrentUser(getRequest()));
    }

    /**
     * 查看茶會地點
     * @param req
     * @return
     */
    @ApiOperation(value="查看茶會地點", notes="查看茶會地點")
    @OperationLogAnnotation(operModul = OperationLogModel.SYSTEM, operType = OperationLogType.QUERY, operTitle = "查看茶會地點", operDesc = "查看茶會地點")
    @PostMapping("/query")
    public Result<MainDataTeaPartyPlaceDTO> query(@RequestBody @Valid MainDataTeaPartyPlaceIdReq req){
        return Result.success(mainDataTeaPartyPlaceService.query(req));
    }

    /**
     * 查看茶會地點列表
     * @param req
     * @return
     */
    @ApiOperation(value="查看茶會地點列表", notes="查看茶會地點列表")
    @OperationLogAnnotation(operModul = OperationLogModel.SYSTEM, operType = OperationLogType.QUERY, operTitle = "查看茶會地點列表", operDesc = "查看茶會地點列表")
    @PostMapping("/list")
    public Result<PageResponse<MainDataTeaPartyPlaceDTO>> list(@RequestBody @Valid MainDataTeaPartyPlaceListReq req){
        return Result.success(mainDataTeaPartyPlaceService.list(req));
    }

}
